<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jstl/core"
                xmlns:sf="http://www.springframework.org/tags/faces"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:spring="http://www.springframework.org/tags"
                template="../../../layout/Template.xhtml">

    <ui:define name="menu">
        <ui:include src="${user.menu}"/>
    </ui:define>

    <ui:define name="title">
        <h:outputText value="#{resourceBundle.createTutorialWelcome}"/>
    </ui:define>

    <ui:define name="footer">
        <h:outputText value="SPiJ - Universite de Marne la Vallee - Version 1.0"/>
    </ui:define>

    <ui:define name="content">

        <ui:fragment id="createTutorialFragment">
            <rich:panel id="createTutorialPanel"
                        header="#{resourceBundle.createTutorialWelcome}">
                <h:form id="createTutorialForm">
                    <h:panelGrid id="createTutorialGrid" columns="3">
                        <h:outputText value="#{resourceBundle.createTutorialFormSubject} : "/>
                        <h:inputText value="#{viewScope.createdTutorial.subject}"
                                     id="subject"
                                     required="true"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageSubject}"/>
                        <h:message for="subject" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormContain} : "/>
                        <rich:editor value="#{viewScope.createdTutorial.contain}"
                                     id="contain"
                                     required="true"
                                     theme="advanced"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageContain}">
                            <f:param name="theme_advanced_toolbar_location" value="top"/>
                            <f:param name="theme_advanced_toolbar_align" value="left"/>
                        </rich:editor>
                        <h:message for="contain" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormCorrection} : "/>
                        <rich:editor value="#{viewScope.createdTutorial.correction}"
                                     id="correction"
                                     required="true"
                                     theme="advanced"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageCorrection}">
                            <f:param name="theme_advanced_toolbar_location" value="top"/>
                            <f:param name="theme_advanced_toolbar_align" value="left"/>
                        </rich:editor>
                        <h:message for="correction" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormLinkSupport} : "/>
                        <h:inputText value="#{viewScope.createdTutorial.linkSupport}"
                                     id="linkSupport"
                                     required="true"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageLinkSupport}"/>
                        <h:message for="linkSupport" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormLinkCorrection} : "/>
                        <h:inputText value="#{viewScope.createdTutorial.linkCorrection}"
                                     id="linkCorrection"
                                     required="true"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageLinkCorrection}"/>
                        <h:message for="linkCorrection" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormStartTime} : "/>
                        <h:inputText value="#{viewScope.createdTutorial.startTime}"
                                     id="startTime"
                                     required="true"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageStartTime}"
                                     converterMessage="#{resourceBundle.createTutorialConverterMessageStartTime}">
                            <f:convertDateTime pattern="HH:mm" type="time"/>
                        </h:inputText>
                        <h:message for="startTime" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormEndTime} : "/>
                        <h:inputText value="#{viewScope.createdTutorial.endTime}"
                                     id="endTime"
                                     required="true"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageEndTime}"
                                     converterMessage="#{resourceBundle.createTutorialConverterMessageEndTime}">
                            <f:convertDateTime pattern="HH:mm" type="time"/>
                        </h:inputText>
                        <h:message for="endTime" style="color:red"/>

                        <h:outputText value="#{resourceBundle.createTutorialFormDate} : "/>
                        <h:inputText value="#{viewScope.createdTutorial.date}"
                                     id="date"
                                     required="true"
                                     requiredMessage="#{resourceBundle.createTutorialRequiredMessageDate}"
                                     converterMessage="#{resourceBundle.createTutorialConverterMessageDate}">
                            <f:convertDateTime pattern="dd/MM/yy" type="date"/>
                        </h:inputText>
                        <h:message for="date" style="color:red"/>
                    </h:panelGrid>

                    <h:messages globalOnly="true"/>

                    <a4j:commandButton type="submit"
                                       value="#{bundle.addButton}" action="add"/>

                    <a4j:commandButton value="#{bundle.cancelButton}" action="cancel"
                                       immediate="true"/>
                </h:form>
            </rich:panel>
        </ui:fragment>
    </ui:define>

</ui:composition>